﻿using System;
using System.IO;

namespace GingerGL.IO
{
    //---------------------------------------------------------------//
    /// <summary>
    /// Reference File System Class
    /// </summary>
    public class ReferenceFileSystem : IFileSystem
    {
        //-----------------------------------------------------------//
        #region Variables
        private IFileSystemContainer m_reference;
        #endregion
        //-----------------------------------------------------------//
        #region Properties
        /// <summary>
        /// Gets/Sets Virtual File System
        /// </summary>
        public IFileSystemContainer FileSystem
        {
            get { return m_reference; }
            set { m_reference = value; }
        }
        #endregion
        //-----------------------------------------------------------//
        #region Constructors
        /// <summary>
        /// Initailizes a new instance of object
        /// </summary>
        public ReferenceFileSystem()
        {
            m_reference = null;
        }
        /// <summary>
        /// Initailizes a new instance of object
        /// </summary>
        public ReferenceFileSystem(IFileSystemContainer system)
        {
            m_reference = system;
        }
        #endregion
        //-----------------------------------------------------------//
        #region Methods
        /// <summary>
        /// Opens File
        /// </summary>
        public Stream Open(string filename)
        {
            return m_reference.FileSystem.Open(filename);
        }
        /// <summary>
        /// Returns TRUE if file exists
        /// </summary>
        public bool Exists(string filename)
        {
            return m_reference.FileSystem.Exists(filename);
        }
        /// <summary>
        /// Gets Full File Path
        /// </summary>
        public string GetFullPath(string filename)
        {
            return m_reference.FileSystem.GetFullPath(filename);
        }
        /// <summary>
        /// Gets a list of files
        /// </summary>
        public string[] GetFiles(string path)
        {
            return m_reference.FileSystem.GetFiles(path);
        }
        /// <summary>
        /// Gets a list of files
        /// </summary>
        public string[] GetFiles(string path, string pattern)
        {
            return m_reference.FileSystem.GetFiles(path, pattern);
        }
        /// <summary>
        /// Gets a list of directories
        /// </summary>
        public string[] GetDirectories(string path)
        {
            return m_reference.FileSystem.GetDirectories(path);
        }
        /// <summary>
        /// Gets a list of directoies
        /// </summary>
        public string[] GetDirectories(string path, string pattern)
        {
            return m_reference.FileSystem.GetDirectories(path, pattern);
        }
        #endregion
        //-----------------------------------------------------------//
    }
    //---------------------------------------------------------------//
}
